package cxf.services;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.jws.WebService;
import javax.xml.ws.Holder;

@WebService(endpointInterface="cxf.services.SimpleService",
		targetNamespace="http://cxftest.simpleservice",
		serviceName="simpleServiceName",
		portName="portName")
public class SimpleServiceImpl implements SimpleService {

	public SimpleResponse getSimpleResp(SimpleRequest request, String token, Holder<String> timeStampHolder) {
		// TODO Auto-generated method stub
//		System.out.println("request's info : user name[" + request.getName() + "]");
		System.out.println("Token in SOAP Header is : " + token);
		SimpleResponse resp = new SimpleResponse();
		
		List<User> users = new ArrayList<User>();
		for (int i=0; i < 3; i++) {
			User user = new User();
			user.setAge(new Integer("23"));
			user.setBirthDay(new Date());
			user.setDep("IT Department");
			user.setEmpID(new Long("1231231"));
			user.setIsMarried(Boolean.TRUE);
			user.setName("Damon");
			
			users.add(user);
		}
		
		resp.setUsers(users);
		timeStampHolder.value = "2011-1-1 00:00:00";
		
		return resp;
	}

	public SimpleResponse getSimpleRespTwo(SimpleRequest request, String token, Holder<String> timeStampHolder) {
		// TODO Auto-generated method stub
//		System.out.println("request's info : user name[" + request.getName() + "]");
		System.out.println("Token in SOAP Header is : " + token);
		SimpleResponse resp = new SimpleResponse();
		
		List<User> users = new ArrayList<User>();
		for (int i=0; i < 3; i++) {
			User user = new User();
			user.setAge(new Integer("23"));
			user.setBirthDay(new Date());
			user.setDep("IT Department");
			user.setEmpID(new Long("1231231"));
			user.setIsMarried(Boolean.TRUE);
			user.setName("Damon");
			
			users.add(user);
		}
		
		resp.setUsers(users);
		timeStampHolder.value = "2011-1-1 00:00:00";
		
		return resp;
	}
}
